home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / netprog.zip / NETPROG.TAR / tftp / netdefs.h < prev    next >
C/C++ Source or Header  |  1989-12-17  |  2KB  |  85 lines

  1. /*
  2.  * Network library header file.
  3.  */
  4.  
  5. #include    "systype.h"
  6. #include    <stdio.h>
  7.  
  8. #define    MAXHOSTNAMELEN      64    /* max size of a host name */
  9. #define    MAXLINE         255    /* line length for error messages */
  10. #define    MAXBUFF        2048    /* max buffer length */
  11.  
  12. /*
  13.  * Debug macro, based on the traceflag.
  14.  * Note that a daemon typically freopen()s stderr to another file
  15.  * for debugging purposes.
  16.  */
  17.  
  18. #define    DEBUG(fmt)        if (traceflag) { \
  19.                     fprintf(stderr, fmt); \
  20.                     fputc('\n', stderr); \
  21.                     fflush(stderr); \
  22.                 } else ;
  23.  
  24. #define    DEBUG1(fmt, arg1)    if (traceflag) { \
  25.                     fprintf(stderr, fmt, arg1); \
  26.                     fputc('\n', stderr); \
  27.                     fflush(stderr); \
  28.                 } else ;
  29.  
  30. #define    DEBUG2(fmt, arg1, arg2)    if (traceflag) { \
  31.                     fprintf(stderr, fmt, arg1, arg2); \
  32.                     fputc('\n', stderr); \
  33.                     fflush(stderr); \
  34.                 } else ;
  35.  
  36. #define    DEBUG3(fmt, arg1, arg2, arg3)    if (traceflag) { \
  37.                     fprintf(stderr, fmt, arg1, arg2, arg3); \
  38.                     fputc('\n', stderr); \
  39.                     fflush(stderr); \
  40.                 } else ;
  41.  
  42. #ifdef    BSD
  43. #include    <sys/types.h>
  44. #include    <sys/socket.h>
  45. #include    <netdb.h>
  46. #endif
  47.  
  48. #ifdef    i386
  49. #include    <sys/types.h>
  50. #include    <sys/socket.h>
  51. #include    <netdb.h>
  52. #endif
  53.  
  54. #ifdef    XENIX
  55. #include    <sys/types.h>
  56. #include    <sys/socket.h>
  57.             /* there isn't a <netdb.h> for Excelan */
  58.  
  59. /*
  60.  * Host structure.
  61.  */
  62.  
  63. struct hostent {
  64.   char    *h_name;    /* official name of host */
  65.   int    h_addrtype;    /* type of address, always AF_INET for now */
  66.   int    h_length;    /* length of address */
  67.   char    *h_addr;    /* address */
  68. };
  69.  
  70. /*
  71.  * Service structure.
  72.  */
  73.  
  74. struct servent {
  75.   char    *s_name;    /* official name of service */
  76.   short    s_port;        /* port number for service (in network byte order) */
  77.   char    *s_proto;    /* name of protocol for service */
  78. };
  79.  
  80. char        *inet_ntoa();
  81. struct hostent    *gethostbyname();
  82. struct servent    *getservbyname();
  83.  
  84. #endif    /* XENIX */
  85.